import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import mytablemodel 1.0

Window {
    id:rectangle
    visible: true
    width: 800
    height: 480
    title: qsTr("Hello World")
    color: "#0A3653"
    property int selectedView: 0
    Component.onCompleted: {
        myLoader.source="SilosShow.qml"
    }
    // 全局鼠标区域，用于检测屏幕点击
    MouseArea {
        id: globalMouseArea
        anchors.fill: parent
        propagateComposedEvents: true  // 允许事件继续传递
        z: 9999  // 确保在全屏按钮下方
        
        onClicked: {
            // 只有当全屏按钮不可见时才重置定时器
            //console.log("onClicked");
            mymodbus.beep(50)
            mouse.accepted = false  // 允许事件继续传递到下层组件
        }
        
        onPressed: {
            // 只有当全屏按钮不可见时才重置定时器
            //console.log("onPressed");
            mymodbus.beep(50)
            mouse.accepted = false
        }
    }
    Item
    {
        id: mainItem_
        anchors.fill:parent
        visible: true
        Item {
            id: mainItem
            anchors.left: parent.left
            anchors.right: parent.right
            height: parent.height 

            //property int currentViewIndex: 0
            Loader {
                id: myLoader
                anchors.fill:parent                
                asynchronous: true
                visible:true
                onSourceChanged: {
                    loaderText.visible = false
                }
            }            
        }
        MyBuzyIndicator{
            anchors.centerIn: parent
            id: mainLoader
            visible:myLoader.visible&&myLoader.status!=Component.Ready
        }
        Text
        {
            id:loaderText
            visible:false
            width:350
            height:150
            anchors.centerIn: parent
            font.pixelSize: 50
            horizontalAlignment: Text.AlignHCenter//(1)
            verticalAlignment: Text.AlignVCenter//(2)
            text: "Processing..."
            color:"white"
            Rectangle{
                anchors.fill:parent
                color: Qt.rgba(10/255, 54/255, 83/255, 0.5)
                z:-1
            }
        }        
    }
}
